#include "bossManager.h"
#include "selfBoneManager.h"

bossManager* bossManager::_instance = 0;

bossManager* bossManager::Instance()
{
	if (_instance == NULL)
	{
		_instance = new bossManager();
	}
	return _instance;
}

bossManager::bossManager()
{

}

void bossManager::updata()
{
	for (vector<Boss*>::iterator itor = manager.begin();
		itor != manager.end();)
	{
		if ((*itor)->checkRemove())
		{
			delete *itor;
			itor = manager.erase(itor);
		}else
		{
			(*itor)->updata();
			itor++;
		}
	}
	//cout << manager.size() << endl;
}

void bossManager::draw()
{
	for (vector<Boss*>::iterator itor = manager.begin();
		itor != manager.end(); itor++)
	{
		(*itor)->draw();
	}
}

void bossManager::add(Boss* b)
{
	manager.push_back(b);
}

void bossManager::checkHitBullet()
{
	selfBulletManager* m = 0;
	m = m->Instance();

	for (vector<Boss*>::iterator itor = manager.begin();
		itor != manager.end(); itor++)
	{
		for (list<selfBullet*>::iterator itor1 = m->manager.begin();
			itor1 != m->manager.end(); itor1++)
		{
			(*itor)->checkHit(**itor1);
		}
	}

	selfBoneManager* m1 = 0;
	m1 = m1->Instance();
	for (vector<Boss*>::iterator itor = manager.begin();
		itor != manager.end(); itor++)
	{
		for (list<Bullet*>::iterator itor1 = m1->manager.begin();
			itor1 != m1->manager.end(); itor1++)
		{
			(*itor1)->checkHit(**itor);
		}
	}
	m1 = 0;
}